.( ;Output of bytecode_compiler.f )

(
: sub  dup drop ;
: hi   # $2000 vp! # 1 # 1 + v! sub ;
entry wat  # 1 @ if # 2 if # 3 then then b: PAD_STATE end
)

label frames
dw ms_player_idle_right
dw ms_player_idle_left
dw ms_player_idle_fwd
dw ms_player_idle_back
dw ms_player_jog_right_0 \ 4
dw ms_player_jog_right_1 \ 5
dw ms_player_jog_left_0  \ 6
dw ms_player_jog_left_1  \ 7
dw ms_player_jog_fwd_0   \ 8
dw ms_player_jog_fwd_1   \ 9
dw ms_player_jog_back_0  \ 10
dw ms_player_jog_back_1  \ 11
dw ms_player_pickup_fwd


: framebase
	b: PAD_STATE @
		dup b: PAD_UP and if drop # 10 # 16 # 255 b: PLAYER_Y +! exit then
		dup b: PAD_DOWN and if drop # 8 # 16 # 1 b: PLAYER_Y +! exit then
		dup b: PAD_LEFT and if drop # 6 # 8 # 255 b: PLAYER_X +! exit then
		b: PAD_RIGHT and if # 4 # 8 # 1 b: PLAYER_X +! exit then
		# 0 dup ;

: playersprite
	a: frames
	framebase b: FRAMECNT @ and if 1+ then 2* +a @+ @+ ;

: drawplayer
	# 0 b: PLAYER_X @ b: PLAYER_Y @ 120 playersprite metaspr ;

entry script
	drawplayer
	end

